﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace homework2
{
     public class Mainprogram
    {
        public static void Main(string[] args)
        {
            try
            {
                List<IShape> shapes = new List<IShape>();
                for (int i = 0; i < 10; i++)
                {
                    shapes.Add(ShapeFactory.CreateRandomShape());
                }
                shapes.ForEach(s => Console.WriteLine($"{s.information}     Area：{s.Area}"));

                double sum = shapes.Sum(s => s.Area);
                Console.WriteLine($"sum = {sum}");

            } catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}
